package core;

import java.util.HashMap;
import java.util.Vector;

/**
 * @author Gary
 */
public class GameMap {

    // Server Information
    private GameServer gameServer;
    // Map Information
    private String map_id;
    private short type;
    private String name;
    // Other Information
    //man- private HashMap<Integer, GameBug> bugList;
    private HashMap<Integer, GameCharacter> characterList;
    //man - private HashMap<Integer, GameNPC> npcList;

    public GameMap(GameServer gameServer, short type) {
        this.gameServer = gameServer;
        this.type = type;
    }

    public GameMap(String map_id, String name, GameMap map) {
        this.map_id = map_id;
        this.name = name;

        this.gameServer = map.getGameServer();
        this.type = map.getType();

        //man - bugList = new HashMap<Integer, GameBug>();
        characterList = new HashMap<Integer, GameCharacter>();
        //man- npcList = new HashMap<Integer, GameNPC>();
    }

    public GameServer getGameServer() {
        return gameServer;
    }

    public String getID() {
        return map_id;
    }

    public String setID(String map_id) {
        return this.map_id = map_id;
    }

    public short getType() {
        return type;
    }

    public short setType(short type) {
        return this.type = type;
    }

    public String getName() {
        return name;
    }

    public String setName(String name) {
        return this.name = name;
    }
    /*man-
    public GameBug getBug(int bug_id) {
        return bugList.get(bug_id);
    }

    public GameBug setBug(GameBug bug) {
        return bugList.put(bug.getID(), bug);
    }

    public GameBug removeBug(int bug_id) {
        return bugList.remove(bug_id);
    }*/

    public GameCharacter getCharacter(int char_id) {
        return characterList.get(char_id);
    }

    public GameCharacter setCharacter(GameCharacter character) {
        return characterList.put(character.getID(), character);
    }

    public GameCharacter removeCharacter(int char_id) {
        return characterList.remove(char_id);
    }
    /*man-
    public GameNPC getNPC(int npc_id) {
        return npcList.get(npc_id);
    }

    public GameNPC setNPC(GameNPC npc) {
        return npcList.put(npc.getID(), npc);
    }

    public GameNPC removeNPC(int npc_id) {
        return npcList.remove(npc_id);
    }

    public Vector<GameBug> getBugList() {
        return new Vector<GameBug>(bugList.values());
    }*/

    public Vector<GameCharacter> getCharacterList() {
        return new Vector<GameCharacter>(characterList.values());
    }

    /*man-
    public Vector<GameNPC> getNPCList() {
        return new Vector<GameNPC>(npcList.values());
    }*/

    /*man-
    public Vector<GameUser> getUserList() {
        Vector<GameUser> userList = new Vector<GameUser>();

        for (GameCharacter character : characterList.values()) {
            GameUser user = gameServer.getActiveUser(character.getUserID());

            if (user != null) {
                userList.add(user);
            }
        }

        //GameUser bugUser = gameServer.getActiveUser(Constants.BUG_USER_ID);

        //if (bugUser != null) {
            //userList.add(bugUser);
        //}

        return userList;
    }*/
}
